Skip to content

DOC: Fix flake8 issues with whatsnew v0.18.* #24303

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from
Dec 18, 2018

Conversation

JimJeon
Copy link
Contributor

@JimJeon JimJeon commented Dec 16, 2018

Fixed almost every flake8 issues in v0.18.*.rst except one issue
about tab-completion.

I fixed almost every flake8 issues except one.
An issue about tab-completion and I have no idea how to fix it.

In doc/source/whatsnew/v0.18.0.rst there is a code like below.

In [9]: r.<TAB>
r.A           r.agg         r.apply       r.count       r.exclusions  r.max         r.median      r.name        r.skew        r.sum
r.B           r.aggregate   r.corr        r.cov         r.kurt        r.mean        r.min         r.quantile    r.std         r.var

I've searched with grep in every whatsnew files but there was only one other example about this in v0.17.0.rst. Would you review this PR?

Fixed almost every flake8 issues in v0.18.*.rst except one issue
about tab-completion.
From conversations in pandas-dev#24273, I found that everywhere in pandas
documentation should use `io` and not `compat`.
@saurav2608
Copy link

thanks @JimJeon : Please wait for a formal review from the maintainers. I just want to point that you have to remove the block between 8 & 11 for both the files (the below chunk should be deleted). Removal should generate some more errors.

.. ipython:: python
   :suppress:

   from pandas import * # noqa F401, F403

@datapythonista
Copy link
Member

also, for the tab error, we use a noqa, do a grep "<TAB>" *.rst to see other cases

@codecov
Copy link

codecov bot commented Dec 16, 2018

Codecov Report

Merging #24303 into master will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff           @@
##           master   #24303   +/-   ##
=======================================
  Coverage   92.28%   92.28%           
=======================================
  Files         162      162           
  Lines       51827    51827           
=======================================
  Hits        47827    47827           
  Misses       4000     4000
Flag Coverage Δ
#multiple 90.68% <ø> (ø) ⬆️
#single 43.01% <ø> (ø) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 41681c8...7e4bc37. Read the comment docs.

@codecov
Copy link

codecov bot commented Dec 16, 2018

Codecov Report

Merging #24303 into master will increase coverage by <.01%.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff             @@
##           master   #24303      +/-   ##
==========================================
+ Coverage   92.28%   92.28%   +<.01%     
==========================================
  Files         162      162              
  Lines       51827    51831       +4     
==========================================
+ Hits        47827    47831       +4     
  Misses       4000     4000
Flag Coverage Δ
#multiple 90.68% <ø> (-0.01%) ⬇️
#single 43% <ø> (-0.02%) ⬇️
Impacted Files Coverage Δ
pandas/util/_test_decorators.py 90.54% <0%> (-2.71%) ⬇️
pandas/core/indexes/period.py 93.06% <0%> (ø) ⬆️
pandas/core/indexes/accessors.py 91.08% <0%> (ø) ⬆️
pandas/core/arrays/datetimelike.py 96.44% <0%> (ø) ⬆️
pandas/core/arrays/period.py 98.5% <0%> (+0.01%) ⬆️
pandas/util/testing.py 87.58% <0%> (+0.09%) ⬆️
pandas/plotting/_converter.py 63.82% <0%> (+0.14%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 41681c8...a17fa1b. Read the comment docs.

Copy link
Member

@datapythonista datapythonista left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, added some comments, also what @saurav2608 said and the tab.

@@ -53,6 +53,7 @@ Friday before MLK Day

.. ipython:: python

from datetime import datetime
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can you use import datetime instead, and use datetime.datetime(...) below

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure. May I ask why you prefer that?
Is that because it can cause some namespace issues?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are many reasons, and some are not trivial to explain.

The main one is that if I see a bare datetime in Python code, I need to guess whether it's the main module, or the datetime.datetime module. While there is no ambiguity in reading datetime.datetime.

Then, with a from datetime import datetime I load the whole datetime module in sys.modules, but I only have access in the namespace to the datetime.datetime submodule (with the name datetime). This won't let me perform operations like imp.reload(datetime), as I don't have anything in the namespace pointing to the main datetime module.

freq='12H'),
['a', 'b']]))
index=pd.MultiIndex.
from_product([pd.date_range('20130101',
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I found this indentation confusing. If the lines are too long, can we use something like:

dft2 = pd.DataFrame(
    np.random.randn(20, 1),
    ...

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the comment. I wasn't flexible with that. I'll fix it.

@@ -451,15 +454,17 @@ New Behavior:
.. code-block:: python
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
.. code-block:: python
.. code-block:: ipython

.. ipython:: python
:suppress:

from io import StringIO
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can you use import io instead, and have the import visible in the next block, where it's used.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure. I'll fix it.

@JimJeon
Copy link
Contributor Author

JimJeon commented Dec 17, 2018

@saurav2608 @datapythonista Thanks for the reviews!

.. ipython:: python
:suppress:

import io
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can you move the import to the beginning of the next code block, and remove this block.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure.

@jreback jreback added this to the 0.24.0 milestone Dec 17, 2018
In order to standardize the ``read_csv`` API for both the ``c`` and ``python`` engines, both will now raise an
``EmptyDataError``, a subclass of ``ValueError``, in response to empty columns or header (:issue:`12493`, :issue:`12506`)

Previous behaviour:

.. code-block:: ipython
In [1]: import io
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you need a blank line here

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks.

@jreback
Copy link
Contributor

jreback commented Dec 17, 2018

some comments. ping on green.

Copy link
Member

@datapythonista datapythonista left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm, thanks @JimJeon

@jreback jreback merged commit 6c67c78 into pandas-dev:master Dec 18, 2018
@jreback
Copy link
Contributor

jreback commented Dec 18, 2018

thanks

TomAugspurger pushed a commit to TomAugspurger/pandas that referenced this pull request Dec 20, 2018
Pingviinituutti pushed a commit to Pingviinituutti/pandas that referenced this pull request Feb 28, 2019
Pingviinituutti pushed a commit to Pingviinituutti/pandas that referenced this pull request Feb 28, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

DOC: Fix flake8 issues in doc/source/whatsnew/v0.18.*.rst
4 participants